package com.hxzy.config;

import com.hxzy.comm.Constants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author wy
 * @Description 路由模型
 * @Date 2023/5/25 14:33
 * @Version 1.0
 */
@Configuration
public class RouterExchangeConfig {


    /**
     * 路由
     * @return
     */
    @Bean
    public DirectExchange demoDirectExchange(){
        DirectExchange directExchange=new DirectExchange(Constants.DRIECT_EXCHNAGE_DEMO);
        return directExchange;
    }


    @Bean
    public Binding  bindingDirect01(DirectExchange demoDirectExchange,Queue demoQeueu){
        return BindingBuilder.bind(demoQeueu).to(demoDirectExchange).with(Constants.QUEUE_DEMO);
    }

    @Bean
    public Binding  bindingDirect02(DirectExchange demoDirectExchange,Queue testQeueu){
        return BindingBuilder.bind(testQeueu).to(demoDirectExchange).with(Constants.QUEUE_TEST);
    }
}
